Micron Document
Fox's Git Mirrors

Commit fece36b228f01430ad7afe415dcefc9490024bdf


Parents : bee66e6
Author : Ivan <e318cbc04468bd574db2b4523dddd710>
Signature : T66BB85Valid, signed by author
Date : 2026-08-10T15:46:21-05:00

feat: implement platform-specific signal handling for shell interactions with separate files for Unix and non-Unix systems

Changes
Diff

diff --git a/pkg/cli/sh.go b/pkg/cli/sh.go
index b8ac612f..dd53eeed 100644
--- a/pkg/cli/sh.go
+++ b/pkg/cli/sh.go
@@ -485,16 +485,17 @@ afterAuth:
}()
sig := make(chan os.Signal, 1)
- signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM, syscall.SIGWINCH)
+ notifyShellSignals(sig)
go func() {
for {
select {
case <-done:
return
case s := <-sig:
- if s == syscall.SIGWINCH {
+ if shellSignalWinch(s, func() {
r, c := ttySize()
_ = sess.SendWinSize(r, c, 0, 0)
+ }) {
continue
}
shutdown()

diff --git a/pkg/cli/sh_signals_other.go b/pkg/cli/sh_signals_other.go
new file mode 100644
index 00000000..d27f5e03
--- /dev/null
+++ b/pkg/cli/sh_signals_other.go
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright (c) 2024-2026 Quad4.io
+
+//go:build !unix
+
+package cli
+
+import (
+ "os"
+ "os/signal"
+ "syscall"
+)
+
+func notifyShellSignals(sig chan os.Signal) {
+ signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
+}
+
+func shellSignalWinch(os.Signal, func()) bool {
+ return false
+}

diff --git a/pkg/cli/sh_signals_unix.go b/pkg/cli/sh_signals_unix.go
new file mode 100644
index 00000000..f09f9e18
--- /dev/null
+++ b/pkg/cli/sh_signals_unix.go
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright (c) 2024-2026 Quad4.io
+
+//go:build unix
+
+package cli
+
+import (
+ "os"
+ "os/signal"
+ "syscall"
+)
+
+func notifyShellSignals(sig chan os.Signal) {
+ signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM, syscall.SIGWINCH)
+}
+
+func shellSignalWinch(s os.Signal, onWinch func()) bool {
+ if s == syscall.SIGWINCH {
+ onWinch()
+ return true
+ }
+ return false
+}

diff --git a/pkg/protect/engine.go b/pkg/protect/engine.go
index 82d9f5cd..2d82873f 100644
--- a/pkg/protect/engine.go
+++ b/pkg/protect/engine.go
@@ -104,7 +104,7 @@ type Engine struct {
handshake int
warns map[warnKey]*warnState
shedMemory atomic.Bool
- tripCounts [reasonCount]uint64
+ tripCounts [reasonCount]atomic.Uint64
autoPhase atomic.Int32
fingerprint string
promoted bool
@@ -367,7 +367,7 @@ func (e *Engine) TripCount(reason Reason) uint64 {
if e == nil || reason < 0 || int(reason) >= len(e.tripCounts) {
return 0
}
- return atomic.LoadUint64(&e.tripCounts[reason])
+ return e.tripCounts[reason].Load()
}
func (e *Engine) ifaceLocked(name string) *ifaceState {
@@ -661,7 +661,7 @@ func (e *Engine) decide(iface string, reason Reason) Decision {
func (e *Engine) recordTrip(iface string, reason Reason) {
if reason > ReasonNone && int(reason) < len(e.tripCounts) {
- atomic.AddUint64(&e.tripCounts[reason], 1)
+ e.tripCounts[reason].Add(1)
}
health.Inc(iface, reason.HealthKind())
e.warn(iface, reason)

diff --git a/reticulum-go.rsm b/reticulum-go.rsm
index ba167d91..a60af5a8 100644
Binary files a/reticulum-go.rsm and b/reticulum-go.rsm differ

diff --git a/vendor/github.com/creack/goselect/fdset_64.go b/vendor/github.com/creack/goselect/fdset_64.go
index 142023be..7fb7726e 100644
--- a/vendor/github.com/creack/goselect/fdset_64.go
+++ b/vendor/github.com/creack/goselect/fdset_64.go
@@ -1,5 +1,5 @@
// +build !darwin,!netbsd,!openbsd
-// +build amd64 arm64 ppc64le mips64 mips64le s390x riscv64
+// +build amd64 arm64 ppc64 ppc64le mips64 mips64le s390x riscv64
package goselect

diff --git a/vendor/go.bug.st/serial/serial_specialbaudrate_linux.go b/vendor/go.bug.st/serial/serial_specialbaudrate_linux.go
index ff48974c..6e0f2e30 100644
--- a/vendor/go.bug.st/serial/serial_specialbaudrate_linux.go
+++ b/vendor/go.bug.st/serial/serial_specialbaudrate_linux.go
@@ -4,7 +4,7 @@
// license that can be found in the LICENSE file.
//
-//go:build linux && !ppc64le
+//go:build linux && !ppc64le && !ppc64
package serial

diff --git a/vendor/go.bug.st/serial/serial_specialbaudrate_linux_ppc64.go b/vendor/go.bug.st/serial/serial_specialbaudrate_linux_ppc64.go
new file mode 100644
index 00000000..cd80b86e
--- /dev/null
+++ b/vendor/go.bug.st/serial/serial_specialbaudrate_linux_ppc64.go
@@ -0,0 +1,12 @@
+//
+// Copyright 2014-2023 Cristian Maglie. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+//
+
+package serial
+
+func (port *unixPort) setSpecialBaudrate(speed uint32) error {
+ // TODO: unimplemented
+ return &PortError{code: InvalidSpeed}
+}

Served by rngit 1.5.2 - Generated in 0.09s